package com.cms.recursoshumanos.component.dialog;

import com.example.frontendrecursoshumanos.R;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class CustomMotivoDialog extends Dialog 
{
    private EditText mMotivo;
    public interface EditDialogListener 
  	{
        public void ready(String motivo);
        public void cancelled();
    }

    private EditDialogListener mReadyListener;

    public CustomMotivoDialog(Context context,EditDialogListener readyListener) 
    {
        super(context);
        this.setTitle("Cancelacion de Sol.");
        mReadyListener = readyListener;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.elementos_motivo_dialog);
        mMotivo = (EditText) findViewById(R.id.etMotivo);
        
        Button buttonOK = (Button) findViewById(R.id.dialogOK);
        Button buttonCancel = (Button) findViewById(R.id.dialogCancel);
        buttonOK.setOnClickListener(new android.view.View.OnClickListener()
        {
            public void onClick(View v) 
            {
                
                mReadyListener.ready(mMotivo.getText().toString());
                CustomMotivoDialog.this.dismiss();
            }
        });
        buttonCancel.setOnClickListener(new android.view.View.OnClickListener(){
            public void onClick(View v) 
            {
                mReadyListener.cancelled();
                CustomMotivoDialog.this.dismiss();
            }
        });
    }
}